SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


SET search_path = public, pg_catalog;

CREATE FUNCTION wprocessor_get_fields_layout(specification_num integer, layout_num integer, ident_layout character varying, start character varying, width character varying) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $_$
/*
 * Procedimento: Extrai campos atraves de uma especificacao e um layout
 */
 declare
  itemlayout record;
  cord varchar;
  result record;
  sql varchar;
  cordident varchar;
 begin

  /* Recebe o layout e prepara as coordenadas */
  cord := '';
  cordident := '';
  for itemlayout in 
    select * 
      from wprocessor_fields 
     where specification = specification_num and layout = layout_num and bypass = false 
  loop
   cord := cord || 'substr(linha, ' || itemlayout.start || ',' || itemlayout.width || ')::varchar as ' || itemlayout.name || ', ';
  end loop;

  cord := substr(cord, 1, char_length(cord)-2);
  cordident := 'substr(linha, ' || start || ',' || width || ')::varchar = ' || chr(39) || ident_layout || chr(39);

  /* Monta a query */
  sql := $$select $$ || cord || $$ from tmp_entrada where $$ || cordident;

  raise notice 'SQL->%',sql;

  /* Exibe as linhas com corte */
  for result in execute sql loop
   return next result;
  end loop;
  return;
end;
$_$;

CREATE FUNCTION wprocessor_get_files_import(arquivo character varying, encoding character varying DEFAULT 'WIN1250'::character varying, fields character varying DEFAULT ''::character varying, asheader boolean DEFAULT false, asdelimiter character varying DEFAULT ''::character varying) RETURNS integer
    LANGUAGE plpgsql
    AS $_X$
/*
 * Procedimento: Recebe o nome de um arquivo para importacao e abastece tmp_entrada
 */

declare
 nomearquivo varchar;
 registros integer;
 option_import varchar;
begin

  /* Limpa informacoes de entrada caso estas existam */
  drop table
    if exists tmp_entrada;

  /* Cria uma nova tabela temporaria */
  if (char_length(fields) > 0) then
   execute
    $_$create temporary
    table tmp_entrada (
    $_$ || fields || $_$
   )
   with (
    oids=false
   )$_$;
  else
   create temporary
    table tmp_entrada (
    linha varchar
   )
   with (
    oids=false
   );
  end if;

  /*
   * Prepara a codificacao do arquivo para entrada
   * e importa o arquivo depois retorna a codificacao
   * original
   */

  nomearquivo := chr(39) ||  arquivo  || chr(39);
  if (char_length(fields) > 0) then
   raise notice 'executando query delimitador';
   option_import := '';

   if (asheader = true) then
    option_import := ' csv header ';
   end if;

   if (char_length(asdelimiter) > 0) then
    option_import := option_import || ' delimiter ' || '''' || asdelimiter || '''';
   end if;
   begin
    execute $$ set client_encoding to $$ || encoding;
    execute 'copy tmp_entrada from ' || nomearquivo || option_import ;
    reset client_encoding;
   end;
  else
   raise notice 'executando query largura fixa';
   begin
    execute $$ set client_encoding to $$ || encoding;
    execute 'copy tmp_entrada from ' || nomearquivo;
    reset client_encoding;
   end;
  end if;

  /* retorna o numero de registros encontrados */
  registros := count(1) as r from tmp_entrada;
  return registros;

end;
$_X$;

CREATE FUNCTION wprocessor_process(nome_specificacao character varying, caminhoarquivo character varying, arquivos character varying) RETURNS SETOF record
    LANGUAGE plpgsql
    AS $$
/*
 * Procedimento: Processa todos os layouts do tipo largura fixa em wprocessor_specifications
 * Utilizacao:
 *     select * from wprocessor_process('Telefonica Remessa', 'C:\datamart\telefonica', 'BM.SCT.074.F20120420.S000000425.REMESSA') as values ( arquivo varchar, noarquivo integer, spec varchar, layout varchar, descricao varchar, processado integer);
 *
 */
declare
  especificacao       record;
  layouts             record;
  campos              record;
  resultado           record;
  table_exists        record;
  schema_exists       record;
  arquivo             record;   
  importar           varchar;
  formatocampos      varchar;
  linhasimportadas   varchar;
  listacampos        varchar;
  listaformat        varchar;
  comentarios        varchar;  
  destination_object varchar;
  integer_var        integer;
 begin

  -- Lista especificacoes de largura fixa
  for especificacao in  
   select 
    wprocessor_specifications.num, 
    wprocessor_specifications.name as nome,              
    wprocessor_specifications.after_import as pos_processamento
   from wprocessor_specifications
   where wprocessor_specifications.name = nome_specificacao 
  loop
  
   raise notice 'Processando a Especificação %', especificacao.nome;

   -- Lista arquivos na pasta da especificacao
   for arquivo in 
    select unnest(string_to_array(arquivos, ',', '')) as nome 
   loop

    -- Importa os arquivos da lista
    importar := caminhoarquivo || '\' || arquivo.nome;
    linhasimportadas := wprocessor_get_files_import(importar);
    raise notice 'importando arquivo:%', importar 
     || ' com ' || linhasimportadas ||' linhas processadas.';

    -- Lista os layouts da especificacao
    for layouts in 
     select * 
     from wprocessor_layouts 
     where specification = especificacao.num and bypass = false 
    loop

     -- Caminho e nome da tabela de destino
     destination_object := layouts.destination_schema || '.' || layouts.destination_table;

     -- Lista os campos para saida de dados
     listacampos := '';
     listaformat := '';
     comentarios := '';
     for campos in 
      select * 
      from wprocessor_fields 
      where specification = especificacao.num and layout = layouts.num 
     loop

      -- Monta a estrutura da tabela
      formatocampos := campos.format;
      if (campos.format = lower('varchar') or 
       campos.format = lower('character varying') or 
       campos.format = lower('numeric')) then
       formatocampos := campos.format || '(' || campos.width || ')';
       if (campos.format = lower('numeric')) then
         formatocampos := campos.format || '(' || campos.width || ',0)';
       end if;
      end if;
            
      listacampos := listacampos || campos.name || ' ' || formatocampos || ', ';
      listaformat := listaformat || campos.name || ' ' || campos.format || ', ';
      comentarios := comentarios || 'comment on column ' || 
      destination_object || '.' || campos.name || ' IS ' || chr(39) || campos.description || chr(39) || '; ';
     end loop;

    listacampos := substr(listacampos, 1, char_length(listacampos)-2);
    listaformat := substr(listaformat, 1, char_length(listaformat)-2);
    raise notice 'lista de campos:%',listacampos;

    -- Verifica se o esquema de destino existe
    select count(*)::integer as registros
     into schema_exists
     from pg_catalog.pg_tables 
    where schemaname = layouts.destination_schema;

    if (schema_exists.registros) = 0 then
     begin
      execute 'create schema ' || layouts.destination_schema || ';';
      raise notice 'criando esquema:%',layouts.destination_schema;
     end;
    end if;

    -- Verifica se a tabela de destino existe
    select count(*)::integer as registros 
     into table_exists 
     from pg_catalog.pg_tables 
    where schemaname || '.' || tablename = destination_object;

    if (table_exists.registros) = 0 then
     begin
      raise notice 'criando tabela:%',destination_object;
      raise notice 'criando comentários:%',comentarios;
      execute 'create table ' || destination_object || ' ( ' || listacampos || ' );';
      execute 'comment on table ' || destination_object || ' IS ' || chr(39) || layouts.description || chr(39) || '; ';
      execute comentarios;
     end;
    end if;

    -- Verifica se necessita limpar os registros
    if (layouts.trunc = true) then
     begin
      execute 'truncate table ' || destination_object;
     end;
    end if;

    -- Seleciona a informação e acrescenta na tabela de destino
    begin
     execute 'insert into ' || destination_object || 
      ' select * from wprocessor_get_fields_layout( ' 
       || chr(39) || especificacao.num    || chr(39) ||  ',' 
       || chr(39) || layouts.num          || chr(39) ||  ',' 
       || chr(39) || layouts.ident_layout || chr(39) ||  ',' 
       || chr(39) || layouts.ident_start  || chr(39) ||  ',' 
       || chr(39) || layouts.ident_width  || chr(39) ||  
       ') as (' || listaformat || ')';

     -- Busca informações depois do processamento       
     get diagnostics integer_var = row_count;
     raise notice 'layout %', layouts.description || 
     ' processado com ' || integer_var || ' linhas';
	        
     select
      importar as arquivo, 
      linhasimportadas::integer as noarquivo, 
      especificacao.nome as spec, 
      layouts.name as layout, 
      layouts.description as descricao, 
      integer_var as processado 
      into resultado;
     return next resultado;
    end;

    if (char_length(layouts.after_import) > 0) then
     raise notice 'processa funcao do usuario';
     execute 'select ' || layouts.after_import;
    end if;
   end loop;
  end loop;
 end loop;
return;
end;
$$;


SET default_tablespace = '';

SET default_with_oids = true;

CREATE TABLE wprocessor_fields (
    filedate date DEFAULT ('now'::text)::date NOT NULL,
    timerg time without time zone DEFAULT ('now'::text)::time with time zone NOT NULL,
    uid character varying(8) DEFAULT "current_user"() NOT NULL,
    specification integer NOT NULL,
    layout integer NOT NULL,
    num integer NOT NULL,
    name character varying(100) NOT NULL,
    start character varying(100) DEFAULT 0 NOT NULL,
    width character varying(100) DEFAULT 0,
    format character varying(50),
    description character varying(100),
    bypass boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE wprocessor_fields_num_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE wprocessor_fields_num_seq OWNED BY wprocessor_fields.num;

SELECT pg_catalog.setval('wprocessor_fields_num_seq', 1, false);


CREATE TABLE wprocessor_layouts (
    filedate date DEFAULT ('now'::text)::date NOT NULL,
    timerg time without time zone DEFAULT ('now'::text)::time with time zone NOT NULL,
    uid character varying(8) DEFAULT "current_user"() NOT NULL,
    specification integer NOT NULL,
    num integer NOT NULL,
    name character varying(100) NOT NULL,
    ident_layout character varying,
    ident_start character varying(100) DEFAULT 0,
    ident_width character varying(100) DEFAULT 0,
    description character varying(100),
    destination_schema character varying(100),
    destination_table character varying(100),
    asheader boolean,
    asdelimiter character varying(1) DEFAULT ';'::character varying,
    bypass boolean DEFAULT false NOT NULL,
    trunc boolean DEFAULT false NOT NULL,
    after_import character varying
);

CREATE SEQUENCE wprocessor_layouts_num_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE wprocessor_layouts_num_seq OWNED BY wprocessor_layouts.num;


SELECT pg_catalog.setval('wprocessor_layouts_num_seq', 1, true);


CREATE TABLE wprocessor_specifications (
    filedate date DEFAULT ('now'::text)::date NOT NULL,
    timerg time without time zone DEFAULT ('now'::text)::time with time zone NOT NULL,
    uid character varying(8) DEFAULT "current_user"() NOT NULL,
    num integer NOT NULL,
    name character varying(100) NOT NULL,
    after_import character varying
);


CREATE SEQUENCE wprocessor_specifications_num_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE wprocessor_specifications_num_seq OWNED BY wprocessor_specifications.num;


SELECT pg_catalog.setval('wprocessor_specifications_num_seq', 1, true);


ALTER TABLE ONLY wprocessor_fields ALTER COLUMN num SET DEFAULT nextval('wprocessor_fields_num_seq'::regclass);


ALTER TABLE ONLY wprocessor_layouts ALTER COLUMN num SET DEFAULT nextval('wprocessor_layouts_num_seq'::regclass);


ALTER TABLE ONLY wprocessor_specifications ALTER COLUMN num SET DEFAULT nextval('wprocessor_specifications_num_seq'::regclass);

INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 1, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 00, identificação de registro HEADER', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 1, 2, 'dtmovimento', '3', '8', 'varchar', 'Data do movimento, no formato (AAAAMMDD)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 01, identificação de registro com os dados do terminal para atribuição.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 6, 'nome', '52', '70', 'varchar', 'Nome do cliente, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 7, 'nrf', '122', '15', 'varchar', 'Documento (CPF/CNPJ) do cliente preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 8, 'ddd', '137', '2', 'varchar', 'DDD do Telefone, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 9, 'telefone', '139', '8', 'varchar', 'Numero do Telefone, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 10, 'nrc', '147', '11', 'varchar', 'NRC, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 11, 'atis_codcliente', '158', '9', 'varchar', 'Código do Cliente no Atis, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 12, 'atis_codconta', '167', '9', 'varchar', 'Código da Conta no Atis, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 13, 'contato', '176', '30', 'varchar', 'Contato do Terminal (Informações do cadastro da telefônica)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 14, 'observacao', '206', '255', 'varchar', 'Observacao do Terminal (Informações do cadastro da telefônica)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 15, 'localidade', '461', '5', 'varchar', 'Código da localidade do terminal, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 16, 'dtexpiracao', '466', '8', 'varchar', 'Data prevista para retirada do terminal de cobrança, formato (YYYYMMDD)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 2, 17, 'carteira', '474', '60', 'varchar', 'Descrição da Carteira de Cobrança.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 02, identificação de registro com endereços', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 6, 'logradouro', '52', '65', 'varchar', 'Logradouro, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 7, 'numero', '117', '10', 'varchar', 'Numero, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 8, 'complemento', '127', '20', 'varchar', 'Complemento, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 9, 'bairro', '147', '40', 'varchar', 'Bairro, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 10, 'cidade', '187', '50', 'varchar', 'Cidade, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 11, 'cep', '237', '8', 'varchar', 'CEP, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 3, 12, 'uf', '245', '2', 'varchar', 'Unidade Federativa', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 03, identificação de registro com terminais ativos', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 6, 'tpcontato', '52', '1', 'varchar', '1-Telefone, 2-Email.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 7, 'email', '53', '100', 'varchar', 'Email de contato, preenchidos com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 8, 'ddd', '153', '2', 'varchar', 'DDD do Telefone, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 9, 'telefone', '155', '9', 'varchar', 'Numero do Telefone, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 10, 'contato', '164', '30', 'varchar', 'Contato do Terminal (Informações do cadastro da telefônica)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 11, 'observacao', '194', '255', 'varchar', 'Observacao do Terminal (Informações do cadastro da telefônica)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 4, 12, 'localidade', '449', '5', 'varchar', 'Código da localidade do terminal.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 5, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 04, identificação de registro para retirada do terminal de cobrança.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 5, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 5, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 5, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 5, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 6, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 05, identificação de registro para zerar o saldo de dívida', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 6, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 6, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 6, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 6, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 7, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 06, identificação do “Nosso Número” para oferta de parcelamento', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 7, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 7, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 7, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 7, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 7, 6, 'nossonumero', '52', '20', 'varchar', 'Nosso Número para emissão do boleto (oferta de parcelamento)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 7, 7, 'cdbanco', '72', '3', 'varchar', 'Codigo do Banco, preenchido com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 10, identificação de registro com débitos de cliente inadimplentes.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 6, 'id_fatura', '52', '32', 'varchar', 'Identificação da Fatura, preenchidos com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 7, 'dtconta', '84', '6', 'varchar', 'Mês/Ano de referência da Fatura, no formato (YYYYMM).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 8, 'dtvencimento', '90', '8', 'varchar', 'Data de Vencimento da Fatura, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 9, 'vlfatura', '98', '18', 'varchar', 'Valor Fatura. Com 2 casas decimais sem separadores. e zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 8, 10, 'wo', '116', '1', 'varchar', '"S" para fatura WO e "N" para fatura não W.O.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 11, identificação de registro de pagamentos de faturas.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 6, 'id_fatura', '52', '32', 'varchar', 'Identificação da Fatura, preenchidos com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 7, 'dtconta', '84', '6', 'varchar', 'Mês/Ano de referencia da Fatura, no formato (YYYYMM).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 8, 'dtvencimento', '90', '8', 'varchar', 'Data de Vencimento da Fatura, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 9, 'dtpagamento', '98', '8', 'varchar', 'Data de Pagamento da Fatura, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 9, 10, 'vlpagamento', '106', '18', 'varchar', 'Valor do Pagamento. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 12, identificação de registro de ajustes/canc. de fatura.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 6, 'id_fatura', '52', '32', 'varchar', 'Identificação da Fatura, preenchidos com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 7, 'dtconta', '84', '6', 'varchar', 'Mês/Ano de referencia da Fatura, no formato (YYYYMM).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 8, 'dtvencimento', '90', '8', 'varchar', 'Data de Vencimento da Fatura, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 9, 'dtoperacao', '98', '8', 'varchar', 'Data do Ajuste/Cancelamento, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 10, 10, 'vlcancelamento', '106', '18', 'varchar', 'Valor do Ajuste/Canc. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 11, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 15, identificação de registro de emissão de boleto.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 11, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 11, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 11, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 11, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 11, 6, 'cdclassificacao', '52', '2', 'varchar', 'Código da classificação de ciclo. (ANEXO-015)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 18, identificação de registro de emissão de boleto.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 6, 'id_boleto', '52', '19', 'varchar', 'Identificação única do boleto, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 7, 'dtgeracao', '71', '8', 'varchar', 'Data de Geração do Boleto', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 8, 'nome', '79', '70', 'varchar', 'Nome do cliente, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 9, 'nrf', '149', '15', 'varchar', 'Documento (CPF/CNPJ) do cliente preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 10, 'ddd', '164', '2', 'varchar', 'DDD do Telefone, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 11, 'telefone', '166', '8', 'varchar', 'Numero do Telefone, preenchido com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 12, 'id_financiamento', '174', '13', 'varchar', 'Identificação do Financiamento, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 13, 'nrcota', '187', '3', 'varchar', 'Numero da Cota de Financiamento, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 14, 'dtvencimento_1', '190', '8', 'varchar', 'Data de Vencimento, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 15, 'dtvencimento_2', '198', '8', 'varchar', 'Data de Vencimento (Prorrogável), no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 16, 'vlnominaldebito', '206', '18', 'varchar', 'Valor nominal do débito. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 17, 'vlmulta', '224', '18', 'varchar', 'Valor da multa. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 18, 'vljuros', '242', '18', 'varchar', 'Valor de Juros. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 19, 'vlcorrigidodebito', '260', '18', 'varchar', 'Valor do débito corrigido. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 20, 'nossonumero', '278', '20', 'varchar', 'Nosso número s/ dígito.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 21, 'codigobarras', '298', '70', 'varchar', 'Código de Barras.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 22, 'linhadigitavel', '368', '70', 'varchar', 'Linha digitável do boleto.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 23, 'cdbanco', '438', '3', 'varchar', 'Código do banco.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 24, 'cdmodelo', '441', '2', 'varchar', 'Modelo do Boleto. ( ANEXO-010 )', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 25, 'fp1_qtparcela', '443', '3', 'varchar', 'FP1. Quantidade de Parcelas', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 26, 'fp1_vlparcela', '446', '18', 'varchar', 'FP1. Valor da Parcela. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 27, 'fp1_pdesconto', '464', '5', 'varchar', 'FP1. Percentual do desconto. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 28, 'fp2_qtparcela', '469', '3', 'varchar', 'FP2. Quantidade de Parcelas', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 29, 'fp2_vlparcela', '472', '18', 'varchar', 'FP2. Valor da Parcela. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 30, 'fp2_pdesconto', '490', '5', 'varchar', 'FP2. Percentual do desconto. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 31, 'fp3_qtparcela', '495', '3', 'varchar', 'FP3. Quantidade de Parcelas', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 32, 'fp3_vlparcela', '498', '18', 'varchar', 'FP3. Valor da Parcela. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 33, 'fp3_pdesconto', '516', '5', 'varchar', 'FP3. Percentual do desconto. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 34, 'fp4_qtparcela', '521', '3', 'varchar', 'FP4. Quantidade de Parcelas', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 35, 'fp4_vlparcela', '524', '18', 'varchar', 'FP4. Valor da Parcela. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 36, 'fp4_pdesconto', '542', '5', 'varchar', 'FP4. Percentual do desconto. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 37, 'end_logradouro', '547', '65', 'varchar', 'Logradouro, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 38, 'end_numero', '612', '10', 'varchar', 'Numero, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 39, 'end_complemento', '622', '20', 'varchar', 'Complemento, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 40, 'end_bairro', '642', '40', 'varchar', 'Bairro, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 41, 'end_cidade', '682', '50', 'varchar', 'Cidade, preenchidos com brancos a direita', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 42, 'end_cep', '732', '8', 'varchar', 'CEP, preenchidos com zeros a esquerda', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 43, 'end_uf', '740', '2', 'varchar', 'Unidade Federativa', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 44, 'inc1_instrucaocobranca', '742', '100', 'varchar', 'Instrução de cobrança, Linha 1. (Preenchidos com brancos a diretira)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 45, 'inc2_instrucaocobranca', '842', '100', 'varchar', 'Instrução de cobrança, Linha 2. (Preenchidos com brancos a diretira)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 46, 'inc3_instrucaocobranca', '942', '100', 'varchar', 'Instrução de cobrança, Linha 3. (Preenchidos com brancos a diretira)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 47, 'inc4_instrucaocobranca', '1042', '100', 'varchar', 'Instrução de cobrança, Linha 4. (Preenchidos com brancos a diretira)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 48, 'chvassessoria', '1142', '50', 'varchar', 'Chave da Assessoria', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 49, 'tpenvio', '1192', '1', 'varchar', '0-Correio', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 50, 'tpproposta', '1193', '1', 'varchar', '0-Campanha 1-Variável', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 51, 'pcdesconto_1', '1194', '4', 'varchar', '% desconto nominal (Opção 1), com 2 casas decimais sem separador.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 52, 'pcdesconto_2', '1198', '4', 'varchar', '% desconto nominal (Opção 2), com 2 casas decimais sem separador.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 53, 'pcdesconto_3', '1202', '4', 'varchar', '% desconto nominal (Opção 3), com 2 casas decimais sem separador.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 54, 'pcdesconto_4', '1206', '4', 'varchar', '% desconto nominal (Opção 4), com 2 casas decimais sem separador.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 55, 'email', '1210', '100', 'varchar', 'Endereço de Email do cliente', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 12, 56, 'filler', '1310', '739', 'varchar', 'FILLER, brancos.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 20, identificação de registro com financiamentos.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 6, 'id_financiamento', '52', '13', 'varchar', 'Identificação do Financiamento, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 7, 'dtfinanciamento', '65', '8', 'varchar', 'Data de criação do Financiamento, no formado (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 8, 'cdplanotelefonica', '73', '3', 'varchar', 'Código do Plano de Financiamento Atis, preenchido com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 9, 'qtparcelas', '76', '3', 'varchar', 'Quantidade de Parcelas.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 10, 'vlfinanciamento', '79', '18', 'varchar', 'Valor Total Financiado. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 11, 'vlpendente', '97', '18', 'varchar', 'Valor Total Pendente. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 12, 'vldesconto', '115', '18', 'varchar', 'Valor total do desconto. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 13, 'cdstatus', '133', '1', 'varchar', 'Código do status do financ.: 0-Oferta, 1-Pendente, 2-Pago, 3-Anulado.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 14, 'dtstatus', '134', '8', 'varchar', 'Data do status do financiamento, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 13, 15, 'chvassessoria', '142', '50', 'varchar', 'Campo para identificação da negociação pela assessoria.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 21, identificação de registro com cotas de financiamento.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 6, 'id_financiamento', '52', '13', 'varchar', 'Identificação do Financ., preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 7, 'id_fatura', '65', '32', 'varchar', 'Identificação da Fatura, preenchidos com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 8, 'nrcota', '97', '3', 'varchar', 'Numero da Cota de Financiamento, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 9, 'dtconta', '100', '6', 'varchar', 'Mês/Ano de referencia da Cota, no formato (YYYYMM).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 10, 'dtvencto', '106', '8', 'varchar', 'Data de vencimento da Cota, no formato (YYYYMMDDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 11, 'vlcota', '114', '18', 'varchar', 'Valor da Cota. Com 2 casas decimais sem separadores.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 12, 'cdstatus', '132', '1', 'varchar', 'Status da Cota: 1-Pendente, 2-Pago, 3-Anulada.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 13, 'dtstatus', '133', '8', 'varchar', 'Data do status da Cota, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 14, 'cdbarra', '141', '70', 'varchar', 'Código de Barras da Cota com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 15, 'nossonumero', '211', '20', 'varchar', 'Nosso número para emissão do boleto pelo Convênio', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 16, 'tpemissaoboleto', '231', '1', 'varchar', '0-Não Emitir Boleto, 1-Boleto Telefônica, 2-Boleto Convênio', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 14, 17, 'cdbanco', '232', '3', 'varchar', 'Código do Banco, preenchido com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 22, identificação de registro de faturas cíclicas financiadas', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 2, 'id_cliente', '3', '9', 'varchar', 'Identificação do Cliente, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 3, 'id_clientetipo', '12', '1', 'varchar', 'Identificação do Tipo do Cliente. (ANEXO-001)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 4, 'id_fonteorigem', '13', '1', 'varchar', 'Identificação da Fonte de Origem.  (ANEXO-002)', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 5, 'id_terminal', '14', '38', 'varchar', 'Identificação do Terminal, preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 6, 'id_financiamento', '52', '13', 'varchar', 'Identificação do Financ., preenchidos com zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 7, 'id_fatura', '65', '32', 'varchar', 'Identificação da Fatura, preenchidos com brancos a direita.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 8, 'dtconta', '97', '6', 'varchar', 'Mês/Ano de referência da Fatura, no formato (YYYYMM).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 9, 'dtvencimento', '103', '8', 'varchar', 'Data de Vencimento da Fatura, no formato (YYYYMMDD).', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 15, 10, 'vlfatura', '111', '18', 'varchar', 'Valor Fatura. Com 2 casas decimais sem separadores. e zeros a esquerda.', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 16, 1, 'tpregistro', '1', '2', 'varchar', 'Fixo 99', false);
INSERT INTO wprocessor_fields (filedate, timerg, uid, specification, layout, num, name, start, width, format, description, bypass) VALUES ('2012-12-20', '07:44:12.51', 'postgres', 1, 16, 2, 'qtd_reg', '3', '8', 'varchar', 'Qtd. de registros, sem os tipos 00-HEADER e 99-TRAILLER', false);

INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 1, 'header', '00', '1', '2', '· (00) HEADER', 'temp', 'vivoremessa_header', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 2, 'atribuicao', '01', '1', '2', '· (01) ATRIBUIÇÃO', 'temp', 'vivoremessa_atribuicao', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 3, 'enderecos', '02', '1', '2', '· (02) ENDEREÇOS', 'temp', 'vivoremessa_enderecos', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 4, 'telefones_de_contato_emails', '03', '1', '2', '· (03) TELEFONES DE CONTATO / EMAILS', 'temp', 'vivoremessa_telefones_emails', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 5, 'exclusao_de_cobranca', '04', '1', '2', '· (04) EXCLUSÃO DE COBRANÇA', 'temp', 'vivoremessa_exclusao', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 6, 'cliente_sem_saldo_de_divida', '05', '1', '2', '· (05) CLIENTE SEM SALDO DE DÍVIDA', 'temp', 'vivoremessa_sem_saldo', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 7, 'informacoes_do_boleto', '06', '1', '2', '· (06) INFORMAÇÕES DO BOLETO', 'temp', 'vivoremessa_boleto', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 8, 'divida_para_negociacao', '10', '1', '2', '· (10) DÍVIDA PARA NEGOCIAÇÃO', 'temp', 'vivoremessa_divida', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 9, 'pagamento_de_faturas', '11', '1', '2', '· (11) PAGAMENTO DE FATURAS', 'temp', 'vivoremessa_pagamentos', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 10, 'ajuste_cancelamento_de_faturas', '12', '1', '2', '· (12) AJUSTE/CANCELAMENTO DE FATURAS', 'temp', 'vivoremessa_ajustes', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 11, 'classificacao_de_ciclo', '15', '1', '2', '· (15) CLASSIFICAÇÃO DE CICLO', 'temp', 'vivoremessa_classificacao_ciclo', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 12, 'informe_de_emissao_de_boleto', '18', '1', '2', '· (18) INFORME DE EMISSÃO DE BOLETO', 'temp', 'vivoremessa_emissao_boleto', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 13, 'financiamento', '20', '1', '2', '· (20) FINANCIAMENTO', 'temp', 'vivoremessa_financiamento', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 14, 'cotas_de_financiamento', '21', '1', '2', '· (21) COTAS DE FINANCIAMENTO', 'temp', 'vivoremessa_cotas', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 15, 'faturas_financiadas', '22', '1', '2', '· (22) FATURAS FINANCIADAS', 'temp', 'vivoremessa_faturas', NULL, ';', false, false, NULL);
INSERT INTO wprocessor_layouts (filedate, timerg, uid, specification, num, name, ident_layout, ident_start, ident_width, description, destination_schema, destination_table, asheader, asdelimiter, bypass, trunc, after_import) VALUES ('2012-12-20', '07:24:39.248', 'postgres', 1, 16, 'trailler', '99', '1', '2', '· (99) TRAILLER', 'temp', 'vivoremessa_trailler', NULL, ';', false, false, NULL);

INSERT INTO wprocessor_specifications (filedate, timerg, uid, num, name, after_import) VALUES ('2012-12-19', '14:12:59.874', 'postgres', 1, 'Telefonica Remessa', NULL);

ALTER TABLE ONLY wprocessor_fields
    ADD CONSTRAINT primarykey_fields PRIMARY KEY (specification, layout, num);

ALTER TABLE ONLY wprocessor_layouts
    ADD CONSTRAINT primarykey_layouts_num PRIMARY KEY (specification, num);

ALTER TABLE ONLY wprocessor_specifications
    ADD CONSTRAINT primarykey_specifications_num PRIMARY KEY (num);

ALTER TABLE ONLY wprocessor_fields
    ADD CONSTRAINT unique_constraint_field_layou UNIQUE (name, layout);

ALTER TABLE ONLY wprocessor_specifications
    ADD CONSTRAINT unique_constraint_specification_name UNIQUE (name);

CREATE INDEX fki_foreignkey_layout_specification ON wprocessor_layouts USING btree (specification);


ALTER TABLE ONLY wprocessor_fields
    ADD CONSTRAINT foreignkey_field_layout FOREIGN KEY (specification, layout) REFERENCES wprocessor_layouts(specification, num) ON UPDATE RESTRICT ON DELETE RESTRICT;

ALTER TABLE ONLY wprocessor_layouts
    ADD CONSTRAINT foreignkey_layout_specification FOREIGN KEY (specification) REFERENCES wprocessor_specifications(num) ON UPDATE RESTRICT ON DELETE RESTRICT;

